package org.tuling.tlmallusersentineldemo.exception;

import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.tuling.tlmallcommon.Result;
import org.tuling.tlmallusersentineldemo.feign.OrderFeignService;
import org.tuling.tlmallusersentineldemo.feign.dto.OrderDTO;

@Component
public class FallbackOrderFeignServiceFactory implements FallbackFactory<OrderFeignService> {
    @Override
    public OrderFeignService create(Throwable throwable) {

        return new OrderFeignService() {
            @Override
            public Result getOrder(String userId) {
                return Result.failed("=======服务降级了========");
            }

            @Override
            public Result<?> post1(OrderDTO orderDTO) {
                return Result.failed("=======服务降级了========");
            }

            @Override
            public Result<?> post2(OrderDTO orderDTO, String token) {
                return Result.failed("=======服务降级了========");
            }

            @Override
            public Result<?> post3(OrderDTO orderDTO, String userId) {
                return Result.failed("=======服务降级了========");
            }


        };
    }
}